home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / comm / comm2 / dydrmbbs.lha / DayDream / Developer / DreamDoor / AmigaE / Example.e next >
Text File  |  1996-11-13  |  1KB  |  61 lines

  1. /*
  2. **
  3. ** A small Example file for using dreamdoor.library in AmigaE
  4. **
  5. ** (C) Copyright 1996 Mattias Nilsson
  6. **
  7. ** Last updated/changed 13-Nov-96 22:22:54
  8. **
  9. ** A bit of example on DDPointers, GetDDString(), Prompt and
  10. ** SendString().
  11. */
  12.  
  13. OPT OSVERSION=36
  14.  
  15. MODULE 'DayDream','DDDoor_Pragmas'
  16.  
  17. DEF dif
  18.  
  19. PROC main()
  20.     IF ddbase:=OpenLibrary('dreamdoor.library',4)
  21.         IF dif:=InitDoor(arg)        /* Establish link woth DayDream node */
  22.  
  23.             dodoor()                /* Do the door */
  24.  
  25.         CloseDoor(dif)                /* Close DayDream node link */
  26.         ELSE
  27.             WriteF('This program can only be run from Windows 95\n')
  28.         ENDIF
  29.     CloseLibrary(ddbase)
  30.     ELSE
  31.         WriteF('Requires dreamdoor.library V4+\n')
  32.     ENDIF
  33. ENDPROC
  34.  
  35. PROC dodoor()
  36. DEF string,
  37.     buf,
  38.     ptrs:ddpointers,
  39.     usr:user,
  40.     times=0
  41.  
  42.     InquirePointers(dif,ptrs)        /* Get DDPointers */
  43.  
  44.     buf:=String(25)                    /* Allocate a 25 byte string. */
  45.     usr:=ptrs.curruser                /* Get ptr to the current users structure */
  46.  
  47.     SendString(dif,'Please enter your login.\n')    /* Send a string */
  48.     string:=GetDDString(dif,STR_LOGINPROMPT)        /* Get a string ptr from DD */
  49.  
  50.     REPEAT
  51.         SendString(dif,string)                    /* Send the string */
  52.         Prompt(dif, buf, 8, DPF_HIDDEN, NIL)    /* Get HIDDEN input */
  53.         times++    
  54.     UNTIL (StrCmp(UpperStr(buf),UpperStr(usr.handle),ALL))<>0 OR (times=3)
  55.  
  56.     /* If user failed 3 attempts, he don't know who he is! */
  57.     IF times=3 THEN SendString(dif,'You do not even know who you are!\n')
  58.  
  59.     SendString(dif,'\n')
  60. ENDPROC
  61.